import UIKit

public class MarkdownConfiguration {
    public struct CodeBlockOptions {
        public var showHeader: Bool = true
        public var showLanguageLabel: Bool = true
        public var showCopyButton: Bool = true
        public var languageDisplayName: String?
        public var copyButtonImage: UIImage?
        public var copyButtonTitle: String?
        public var headerBackgroundColor: UIColor?
        public var languageLabelFont: UIFont?
        public var languageLabelTextColor: UIColor?
        public var copyButtonTintColor: UIColor?
        public var onCopy: (() -> Void)?
        
        public init() {}
    }
    
    public var codeBlockOptions = CodeBlockOptions()
    
    public init() {}
    
    public func apply(to codeBlockView: CodeBlockView) {
        codeBlockView.showHeader = codeBlockOptions.showHeader
        codeBlockView.showLanguageLabel = codeBlockOptions.showLanguageLabel
        codeBlockView.showCopyButton = codeBlockOptions.showCopyButton
        
        if let name = codeBlockOptions.languageDisplayName {
            codeBlockView.languageDisplayName = name
        }
        
        if let image = codeBlockOptions.copyButtonImage {
            codeBlockView.copyButtonImage = image
        }
        
        if let title = codeBlockOptions.copyButtonTitle {
            codeBlockView.copyButtonTitle = title
        }
        
        if let color = codeBlockOptions.headerBackgroundColor {
            codeBlockView.headerBackgroundColor = color
        }
        
        if let font = codeBlockOptions.languageLabelFont {
            codeBlockView.languageLabelFont = font
        }
        
        if let color = codeBlockOptions.languageLabelTextColor {
            codeBlockView.languageLabelTextColor = color
        }
        
        if let color = codeBlockOptions.copyButtonTintColor {
            codeBlockView.copyButtonTintColor = color
        }
        
        if let callback = codeBlockOptions.onCopy {
            codeBlockView.onCopy = callback
        }
    }
} 